﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btDangky_Click(object sender, EventArgs e)
    {
        try
        {
            lbBaoloi.Text = "";
            String Hoten = txtHoten.Text;
            String Dienthoai = txtDienthoai.Text;
            if (Dienthoai.Length < 10)
            {
                lbBaoloi.Text = "so dien thoai khong dung!";
            }
            else
            {
                String Diachi = txtDiachi.Text;
                int Gioitinh = int.Parse(rdlGioitinh.SelectedItem.Value);
                String Email = txtEmail.Text;
                String TenDN = txtTenDN.Text;
                String Matkhau = txtMatkhau.Text;
                if (Matkhau.Length < 6)
                {
                    lbBaoloi.Text = "Mat khau phai >= 6 ky tu!";
                }
                else
                {
                    String Ngaysinh = ddlThangsinh.Text + "/" + ddlNgaysinh.Text + "/" + txtNam.Text;
                    String str = "INSERT INTO KhachHang(tenkh,dienthoai,diachi,gioitinh,email,tendn,matkhau,ngaysinh) VALUES(N'" + Hoten + "',N'" + Dienthoai + "',N'" + Diachi + "'," + Gioitinh + ",'" + Email + "',N'" + TenDN + "',N'" + Matkhau + "','" + Ngaysinh + "')";
                    XLDL.thuchienlenh(str);
                    PanelThongbao.Visible = true;
                }
            }
        }
        catch
        {
            lbBaoloi.Text = "Thất bại!";
        }

    }
    protected void txtDienthoai_TextChanged(object sender, EventArgs e)
    {

    }
}